<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>计数器-小案例</title>
    <script src="../lib/vue_v2.6.14.js"></script>
  </head>
  <body>
    <div id="app">
      <h2>当前计数：{{ count }}</h2>
      <button @click="addCount">+</button>
      <button @click="subCount">-</button>
    </div>

    <script>
      const vm = new Vue({
        el: '#app',
        data: {
          count: 0
        },
        methods: {
          addCount() {
            this.count++
          },
          subCount() {
            this.count--
          }
        }
      })
    </script>
  </body>
</html>
